home *** CD-ROM | disk | FTP | other *** search
- /******************************************************************/
- /* */
- /* TurboCAD for Windows */
- /* Copyright (c) 1993 - 2001 */
- /* International Microcomputer Software, Inc. */
- /* (IMSI) */
- /* All rights reserved. */
- /* */
- /******************************************************************/
-
- // PalDlg.cpp : implementation file
- //
-
- #include "stdafx.h"
- #include "CustomPalette.h"
- #include "PalDlg.h"
-
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
-
- /////////////////////////////////////////////////////////////////////////////
- // CPalDlg dialog
-
-
- CPalDlg::CPalDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CPalDlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CPalDlg)
- // NOTE: the ClassWizard will add member initialization here
- //}}AFX_DATA_INIT
- }
-
- IMPLEMENT_DYNAMIC(CPalDlg, CDialog)
-
- void CPalDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CPalDlg)
- // NOTE: the ClassWizard will add DDX and DDV calls here
- //}}AFX_DATA_MAP
- }
-
-
- BEGIN_MESSAGE_MAP(CPalDlg, CDialog)
- //{{AFX_MSG_MAP(CPalDlg)
- ON_BN_CLICKED(IDC_TEST, OnTest)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
- /////////////////////////////////////////////////////////////////////////////
- // CPalDlg message handlers
- /*
- IApplication* GetTcApp()
- {
- IApplication *pIApplication = NULL;
-
- BOOL bCreateInstance = TRUE;
- IUnknown* pUnk = NULL;
- HRESULT hRes = ::GetActiveObject(CLSID_Application, NULL, &pUnk);
- if (pUnk == NULL)
- return NULL;
-
- hRes = pUnk->QueryInterface(IID_IApplication, (void**)&pIApplication);
- pUnk->Release();
- if (FAILED(hRes))
- return NULL;
-
- return pIApplication;
- }
- */
- IApplication* GetTcApp()
- {
- IApplication *pIApplication = NULL;
- HRESULT hRes = CoCreateInstance(CLSID_XApplication, NULL, CLSCTX_INPROC_SERVER, IID_IApplication, (void**)&pIApplication);
- if (FAILED(hRes))
- return NULL;
-
- return pIApplication;
-
- }
-
- void CPalDlg::OnTest()
- {
- HRESULT hRes = E_FAIL;
- Drawings* pDrs = NULL;
- long lDrawingsCount = 0;
- CString strTmp;
- strTmp = "There are drawings loaded";
-
- IApplication* pIApp = GetTcApp();
- if(pIApp !=NULL)
- {
- hRes = pIApp->get_Drawings(&pDrs);
- if(SUCCEEDED(hRes))
- {
- hRes = pDrs->get_Count(&lDrawingsCount);
-
- }
- }
- char v[10];
- memset(v, 0, 10);
- _ltoa(lDrawingsCount,v, 10);
- strTmp.Insert (10,v);
- MessageBox(strTmp, "Custom docking palette");
- RELEASE(pDrs);
- RELEASE(pIApp);
- }
-